<script src="{{ asset("js/jquery.autoSuggest.minified.js") }}"></script>
<link href="{{ asset("css/autoSuggest.css") }}" rel="stylesheet" type="text/css" media="screen" />

<script type="text/javascript">
    $(document).ready(function() {
        $("#metaTags").autoSuggest("{{ path('admin_service_tags') }}", {
            startText: '',
            minChars: 2,
            asHtmlID: 'tags',
            queryParam: 'q',
            preFill: {{ selectedData|default('[]')|raw }},
            {#selectionRemoved: function(elem) {
                var value = elem[0].textContent.substr(1);
                a = elem;
                $.getJSON('/admin/service/tags/delete', {value: value, type: 'word'}, function(response) {
                    if (!response || response.status != 'ok') {
                        console.log('error');
                    }
                });

                elem.remove();
            },#}
            selectedItemProp: "value",
            searchObjProps: "value"
        });
    });
</script>

{{ form.textarea(
        {
            'rows': '3',
            'cols': 118,
            'id': 'metaDescription',
            'name': 'metaDescription',
            'labelName': 'Meta Description',
            'value': metaDescription|default('')
        }
    ) }}

{{ form.input(
        {
            'groupClass': 'col-md-8',
            'id': 'metaTags',
            'name': 'metaTags',
            'labelName': 'Meta Keywords'
        }
    ) }}